package thread;

public class ThreadDemo2
{
    public static void main(String[] args)
    {
        Runnable r1 = new Runnable1();  // 定义任务
        Runnable r2 = new Runnable2(); // 定义任务
        Thread t1 = new Thread(r1); // 定义线程  并且把任务交给线程
        Thread t2 = new Thread(r2); // 定义线程， 并且把任务交给线程
        t1.start();
        t2.start();
    }
}

class Runnable1 implements Runnable
{
    @Override
    public void run()
    {
        for (int i = 0 ; i < 1000 ; i++)
        {
            System.out.println("who are you");
        }
    }
}


class Runnable2 implements Runnable
{
    @Override
    public void run()
    {
        for (int i = 0 ; i < 1000 ; i++)
        {
            System.out.println("a Water delivery man");
        }
    }
}


